package com.myproject.musicrecommendationsystem.controller;

import com.myproject.musicrecommendationsystem.domain.Review;
import com.myproject.musicrecommendationsystem.service.ReviewService;
import com.myproject.musicrecommendationsystem.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@Api(tags="评论管理(0729单禹铭)")
public class ReviewController {
    @Autowired
    private ReviewService service;

    @ApiOperation("新增评论")
    @PostMapping("/addReview")
    public AjaxResult addReview(@RequestBody Review review){
        return AjaxResult.success(service.insert(review));
    }
    @ApiOperation("删除评论")
    @DeleteMapping("deleteReviewById")
    public AjaxResult deleteReviewById(int id){
        return AjaxResult.success(service.deleteById(id));
    }
    @ApiOperation("修改评论")
    @PostMapping("/updateReviewById")
    public AjaxResult updateReviewById(@RequestBody Review review){
        return AjaxResult.success(service.updateById(review));
    }
    @ApiOperation("查看评论")
    @GetMapping("/selectById")
    public AjaxResult selectById(Integer id){
        return AjaxResult.success(service.selectById(id));
    }

}
